package controller;

import java.io.BufferedReader;
import java.io.PrintWriter;

import model.GameClient;

public class ClientListener extends Thread{

	private PrintWriter outputToServer;
	private BufferedReader inputFromServer;
	private GameClient gameClient;

	public ClientListener(PrintWriter oTS, BufferedReader iFS, GameClient gameClient){
		this.outputToServer = oTS;
		this.inputFromServer = iFS;
		this.gameClient = gameClient;
	}

	public void run(){
		try {
			while (true) {
				int message = inputFromServer.read();
				if (message == 1){
					gameClient.chooseSide();
					return;
				}
			}
		} catch (Exception ex) {

		}
	}

}
